package com.gupao.jly521.observer;

import com.gupao.jly521.core.Event;

import java.lang.reflect.Method;

/**
 * @author Jly
 * @date 2018/9/4  15:02
 */
public class ObserverTest {

    public static void main(String[] args) {
        try {
            Observer obs = new Observer();
            Method method = obs.getClass().getMethod("advice",Event.class);

            Subject sub = new Subject();
            sub.addListener(obs,method,SubjectType.ADD);
            sub.add();
            sub.remove();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        }

    }
}
